<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page  import = " java.sql.* "   %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String course_id="";
String course_name="";
String teacher="";
int point;
String tiem1="";
String tiem_1="";
String tiem2="";
String tiem_2="";
String location="";
String limited;
String num;
String time="";
String tiem="";


course_id=request.getParameter("courseid");
course_name=request.getParameter("coursename");
teacher=request.getParameter("teacher");
point=Integer.parseInt(request.getParameter("point"));
tiem1=request.getParameter("time1");
tiem_1=request.getParameter("time_1");
tiem2=request.getParameter("time2");
tiem_2=request.getParameter("time_2");
location=request.getParameter("location");
limited=request.getParameter("limited");
num=request.getParameter("num");
time=request.getParameter("time1")+request.getParameter("time_1");
tiem=request.getParameter("time2")+request.getParameter("time_2");

out.println(course_id);
out.println(course_name);
out.println(teacher);
out.println(point);
out.println(tiem1);
out.println(tiem_1);
out.println(tiem2);
out.println(tiem_2);
out.println(location);
out.println(limited);
out.println(num);
out.println(tiem);
out.println(time);

String sql="insert into course(course_id,course_name,teacher,point,time1,time2,location,limited,selected) values('"+course_id+"','"+course_name+"','"+teacher+"','"+point+"','"+time+"','"+tiem+"','"+location+"','"+limited+"','"+num+"')";

Class.forName("com.mysql.jdbc.Driver").newInstance();  
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/xuanke", "root", "123456");  
Statement stmt1=conn.createStatement();
stmt1.executeUpdate(sql);


%>
</body>
</html>